package de.mhu.mandalaui.properties;

import de.mhu.mandalaui.Component;
import de.mhu.mandalaui.attributes.NamedAttribute;
import de.mhu.mandalaui.text.CheckboxField;
import de.mhu.mandalaui.text.InputField;
import de.mhu.mandalaui.text.Text;

public class BooleanProperty extends Property {

	private CheckboxField view;
	private CheckboxField edit;
	private NamedAttribute dataBind = null;

	public BooleanProperty(String id, String value) {
		if (id != null) dataBind = new NamedAttribute(id);
		view = new CheckboxField();
		view.setEnabled(false);
		view.setBindValue(dataBind);
		
		edit = new CheckboxField();
		edit.setBindValue(dataBind);
		
		
		setId(id);
		setValue(value);
	}

	public String getValue() {
		return view.getText();
	}

	public void setValue(String value) {
		view.setText(value);
	}

	@Override
	public Component getView() {
		return view;
	}

	@Override
	public Component getEdit() {
		return edit;
	}

	@Override
	protected void doInitialize() {
	}

	@Override
	protected void doDestroy() {
//		view = null;
	}
	
}
